import { dialog, ipcMain } from 'electron'

ipcMain.handle('setImageDirectory', async () => {
  const { canceled, filePaths } = await dialog.showOpenDialog({
    title: '选择图片保存目录',
    properties: ['createDirectory', 'openDirectory']
  })

  if (!canceled && filePaths.length > 0) {
    return filePaths[0]
  }

  return
})
